Skip to content

Method: bindBidirectionally(BoundProperty, BooleanProperty)

1: /*
2: * *************************************************************************************************************************************************************
3: *
4: * SteelBlue: DCI User Interfaces
5: * http://tidalwave.it/projects/steelblue
6: *
7: * Copyright (C) 2015 - 2025 by Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *************************************************************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17: * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
18: *
19: * *************************************************************************************************************************************************************
20: *
21: * git clone https://bitbucket.org/tidalwave/steelblue-src
22: * git clone https://github.com/tidalwave-it/steelblue-src
23: *
24: * *************************************************************************************************************************************************************
25: */
26: package it.tidalwave.ui.javafx;
27:
28: import jakarta.annotation.Nonnull;
29: import java.util.Collection;
30: import java.util.Optional;
31: import java.util.function.Function;
32: import java.nio.file.Path;
33: import javafx.beans.property.BooleanProperty;
34: import javafx.beans.property.DoubleProperty;
35: import javafx.beans.property.IntegerProperty;
36: import javafx.beans.property.LongProperty;
37: import javafx.beans.property.Property;
38: import javafx.scene.Node;
39: import javafx.scene.control.ButtonBase;
40: import javafx.scene.control.ComboBox;
41: import javafx.scene.control.ListView;
42: import javafx.scene.control.MenuItem;
43: import javafx.scene.control.TableView;
44: import javafx.scene.control.TextField;
45: import javafx.scene.control.ToggleButton;
46: import javafx.scene.control.TreeTableView;
47: import javafx.scene.control.TreeView;
48: import javafx.scene.layout.GridPane;
49: import javafx.scene.layout.Pane;
50: import javafx.stage.Window;
51: import it.tidalwave.ui.core.BoundProperty;
52: import it.tidalwave.ui.core.UserNotification;
53: import it.tidalwave.ui.core.UserNotificationWithFeedback;
54: import it.tidalwave.ui.core.role.PresentationModel;
55: import it.tidalwave.ui.core.role.UserAction;
56: import it.tidalwave.ui.core.role.Visibility;
57: import it.tidalwave.ui.javafx.role.CustomGraphicProvider;
58:
59: /***************************************************************************************************************************************************************
60: *
61: * @author Fabrizio Giudici
62: *
63: **************************************************************************************************************************************************************/
64: public interface JavaFXBinder
65: {
66: /***********************************************************************************************************************************************************
67: * Sets the main window. This operation must be performed before any other method is called. This operation is automatically performed by the SteelBlue
68: * runtime.
69: * @param window the main window
70: **********************************************************************************************************************************************************/
71: public void setMainWindow (@Nonnull Window window);
72:
73: /***********************************************************************************************************************************************************
74: * Binds a button to a {@link UserAction}. The following roles o the action are used:
75: * <ul>
76: * <li>Displayable: to set the label of the button</li>
77: * </ul>
78: * The action is used as a callback when the button is pressed; invoked in a thread provided by the binder executor. The {@code enabled} property of the
79: * {@code UserAction} is bound, negated, to the {@code disabled} property of the button.
80: * @param button the button
81: * @param action the action
82: **********************************************************************************************************************************************************/
83: public void bind (@Nonnull ButtonBase button, @Nonnull UserAction action);
84:
85: /***********************************************************************************************************************************************************
86: * Binds a menu item to a {@link UserAction}. The following roles o the action are used:
87: * <ul>
88: * <li>Displayable: to set the label of the menu item</li>
89: * </ul>
90: * The action is used as a callback when the button is pressed; invoked in a thread provided by the binder executor. The {@code enabled} property of the
91: * {@code UserAction} is bound, negated, to the {@code disabled} property of the menu item.
92: * @param menuItem the menu item
93: * @param action the action
94: **********************************************************************************************************************************************************/
95: public void bind (@Nonnull MenuItem menuItem, @Nonnull UserAction action);
96:
97: /***********************************************************************************************************************************************************
98: * Binds a {@link TableView} to a {@link PresentationModel} and an optional callback. The {@code PresentationModel} is used to populate the table. The
99: * following roles are used:
100: * <ul>
101: * <li>A {@link it.tidalwave.role.SimpleComposite} provides children {@code PresentationModel}s for each row.</li>
102: * <li>In each row, an {@link it.tidalwave.role.Aggregate<PresentationModel>} is used to provide the {@code PresentationModel}s for
103: * each column.</li>
104: * <li>A {@link it.tidalwave.ui.core.role.Displayable} (optional) is used to provide the text to render for each item.</li>
105: * <li>A {@link CustomGraphicProvider} (optional) is used to provide the graphics to render for each item.</li>
106: * <li>A {@link it.tidalwave.ui.core.role.Styleable} (optional) is used to provide the rendering style for each item.</li>
107: * <li>A {@link it.tidalwave.ui.core.role.UserActionProvider} (optional) is used to provide the actions for creating a context menu;
108: * the default action is also bound to the double click or SPACE gesture.</li>
109: * </ul>
110: * The process of populating data is performed in background threads, so this method quickly returns also in case of large amount of data. The
111: * initialization callback is called in the JavaFX thread when data population has been completed.
112: * @param tableView the {@code TablewView}
113: * @param pm the {@code PresentationModel}
114: * @param initCallback the callback
115: * @since 1.0-ALPHA-13
116: **********************************************************************************************************************************************************/
117: public void bind (@Nonnull TableView<PresentationModel> tableView, @Nonnull PresentationModel pm, @Nonnull Optional<Runnable> initCallback);
118:
119: /***********************************************************************************************************************************************************
120: * Binds a {@link TableView} to a {@link PresentationModel} and a callback. See {@link #bind(javafx.scene.control.TableView,
121: * it.tidalwave.ui.core.role.PresentationModel, java.util.Optional)}. The process of populating data is performed in background threads, so this method
122: * quickly returns also in case of large amount of data. The initialization callback is called in the JavaFX thread when data population has been completed.
123: * @param tableView the {@code TablewView}
124: * @param pm the {@code PresentationModel}
125: * @param initCallback the callback
126: **********************************************************************************************************************************************************/
127: public default void bind (@Nonnull final TableView<PresentationModel> tableView, @Nonnull final PresentationModel pm, @Nonnull final Runnable initCallback)
128: {
129: bind(tableView, pm, Optional.of(initCallback));
130: }
131:
132: /***********************************************************************************************************************************************************
133: * Binds a {@link TableView} to a {@link PresentationModel}. See {@link #bind(javafx.scene.control.TableView, it.tidalwave.ui.core.role.PresentationModel,
134: * java.util.Optional)}.
135: * @param tableView the {@code TablewView}
136: * @param pm the {@code PresentationModel}
137: * @since 1.0-ALPHA-13
138: **********************************************************************************************************************************************************/
139: public default void bind (@Nonnull final TableView<PresentationModel> tableView, @Nonnull final PresentationModel pm)
140: {
141: bind(tableView, pm, Optional.empty());
142: }
143:
144: /***********************************************************************************************************************************************************
145: * Binds a {@link TreeView} to a {@link PresentationModel} and a callback. The {@code PresentationModel} is used to populate the table. The following roles
146: * are used:
147: * <ul>
148: * <li>A {@link it.tidalwave.role.SimpleComposite} provides children {@code PresentationModel}s for each row.</li>
149: * <li>In each row, an {@link it.tidalwave.role.Aggregate<PresentationModel>} is used to provide the {@code PresentationModel}s for
150: * each column.</li>
151: * <li>A {@link it.tidalwave.ui.core.role.Displayable} (optional) is used to provide the text to render for each item.</li>
152: * <li>A {@link CustomGraphicProvider} (optional) is used to provide the graphics to render for each item.</li>
153: * <li>A {@link it.tidalwave.ui.core.role.Styleable} (optional) is used to provide the rendering style for each item.</li>
154: * <li>A {@link it.tidalwave.ui.core.role.UserActionProvider} (optional) is used to provide the actions for creating a context menu;
155: * the default action is also bound to the double click or SPACE gesture.</li>
156: * <li>A {@link Visibility} (optional) is used to decide whether the root node should be visible or not.</li>
157: * </ul>
158: * The process of populating data is performed in background threads, so this method quickly returns also in case of large amount of data. The
159: * initialization callback is called in the JavaFX thread when data population has been completed.
160: * @param treeView the {@code TreeView}
161: * @param pm the {@code PresentationModel}
162: * @param initCallback the callback
163: **********************************************************************************************************************************************************/
164: public void bind (@Nonnull TreeView<PresentationModel> treeView, @Nonnull PresentationModel pm, @Nonnull Optional<Runnable> initCallback);
165:
166: /***********************************************************************************************************************************************************
167: * Binds a {@link TableView} to a {@link PresentationModel} and a callback. See {@link #bind(javafx.scene.control.TreeView,
168: * it.tidalwave.ui.core.role.PresentationModel, java.util.Optional)}.
169: * @param treeView the {@code TreeView}
170: * @param pm the {@code PresentationModel}
171: * @param initCallback the callback
172: * @since 1.0-ALPHA-13
173: **********************************************************************************************************************************************************/
174: public default void bind (@Nonnull final TreeView<PresentationModel> treeView, @Nonnull final PresentationModel pm, @Nonnull final Runnable initCallback)
175: {
176: bind(treeView, pm, Optional.of(initCallback));
177: }
178:
179: /***********************************************************************************************************************************************************
180: * Binds a {@link TableView} to a {@link PresentationModel}. See {@link #bind(javafx.scene.control.TableView, it.tidalwave.ui.core.role.PresentationModel,
181: * java.util.Optional)}
182: * @param treeView the {@code TreeView}
183: * @param pm the {@code PresentationModel}
184: * @since 1.0-ALPHA-13
185: **********************************************************************************************************************************************************/
186: public default void bind (@Nonnull final TreeView<PresentationModel> treeView, @Nonnull final PresentationModel pm)
187: {
188: bind(treeView, pm, Optional.empty());
189: }
190:
191: /***********************************************************************************************************************************************************
192: * Binds a {@link TreeTableView} to a {@link PresentationModel} and a callback. The {@code PresentationModel} is used to populate the table. The following
193: * roles are used:
194: * <ul>
195: * <li>A {@link it.tidalwave.role.SimpleComposite} provides children {@code PresentationModel}s for each row.</li>
196: * <li>In each row, an {@link it.tidalwave.role.Aggregate<PresentationModel>} is used to provide the {@code PresentationModel}s for
197: * each column.</li>
198: * <li>A {@link it.tidalwave.ui.core.role.Displayable} (optional) is used to provide the text to render for each item.</li>
199: * <li>A {@link CustomGraphicProvider} (optional) is used to provide the graphics to render for each item.</li>
200: * <li>A {@link it.tidalwave.ui.core.role.Styleable} (optional) is used to provide the rendering style for each item.</li>
201: * <li>A {@link it.tidalwave.ui.core.role.UserActionProvider} (optional) is used to provide the actions for creating a context menu;
202: * the default action is also bound to the double click or SPACE gesture.</li>
203: * <li>A {@link Visibility} (optional) is used to decide whether the root node should be visible or not.</li>
204: * </ul>
205: * The process of populating data is performed in background threads, so this method quickly returns also in case of large amount of data. The
206: * initialization callback is called in the JavaFX thread when data population has been completed.
207: * @param treeTableView the {@code TreeTableView}
208: * @param pm the {@code PresentationModel}
209: * @param initCallback the callback
210: **********************************************************************************************************************************************************/
211: public void bind (@Nonnull TreeTableView<PresentationModel> treeTableView, @Nonnull PresentationModel pm, @Nonnull Optional<Runnable> initCallback);
212:
213: /***********************************************************************************************************************************************************
214: * Binds a {@link TreeTableView} to a {@link PresentationModel} and a callback. See {@link #bind(javafx.scene.control.TreeTableView,
215: * it.tidalwave.ui.core.role.PresentationModel, java.util.Optional)}.
216: * @param treeTableView the {@code TreeTableView}
217: * @param pm the {@code PresentationModel}
218: * @param initCallback the callback
219: * @since 1.0-ALPHA-13
220: **********************************************************************************************************************************************************/
221: public default void bind (@Nonnull final TreeTableView<PresentationModel> treeTableView,
222: @Nonnull final PresentationModel pm,
223: @Nonnull final Runnable initCallback)
224: {
225: bind(treeTableView, pm, Optional.of(initCallback));
226: }
227:
228: /***********************************************************************************************************************************************************
229: * Binds a {@link TreeTableView} to a {@link PresentationModel}. See {@link #bind(javafx.scene.control.TreeTableView,
230: * it.tidalwave.ui.core.role.PresentationModel, java.util.Optional)}.
231: * @param treeTableView the {@code TreeTableView}
232: * @param pm the {@code PresentationModel}
233: * @since 1.0-ALPHA-13
234: **********************************************************************************************************************************************************/
235: public default void bind (@Nonnull final TreeTableView<PresentationModel> treeTableView, @Nonnull final PresentationModel pm)
236: {
237: bind(treeTableView, pm, Optional.empty());
238: }
239:
240: /***********************************************************************************************************************************************************
241: * Binds a {@link ListView} to a {@link PresentationModel} and an optional callback. The {@code PresentationModel} is used to populate the table. The
242: * following roles are used:
243: * <ul>
244: * <li>A {@link it.tidalwave.role.SimpleComposite} provides children {@code PresentationModel}s for each row.</li>
245: * <li>In each row, an {@link it.tidalwave.role.Aggregate<PresentationModel>} is used to provide the {@code PresentationModel}s for
246: * each column.</li>
247: * <li>A {@link it.tidalwave.ui.core.role.Displayable} (optional) is used to provide the text to render for each item.</li>
248: * <li>A {@link CustomGraphicProvider} (optional) is used to provide the graphics to render for each item.</li>
249: * <li>A {@link it.tidalwave.ui.core.role.Styleable} (optional) is used to provide the rendering style for each item.</li>
250: * <li>A {@link it.tidalwave.ui.core.role.UserActionProvider} (optional) is used to provide the actions for creating a context menu;
251: * the default action is also bound to the double click or SPACE gesture.</li>
252: * </ul>
253: * The process of populating data is performed in background threads, so this method quickly returns also in case of large amount of data. The
254: * initialization callback is called in the JavaFX thread when data population has been completed.
255: * @param listView the {@code ListView}
256: * @param pm the {@code PresentationModel}
257: * @param initCallback the callback
258: **********************************************************************************************************************************************************/
259: public void bind (@Nonnull ListView<PresentationModel> listView, @Nonnull PresentationModel pm, @Nonnull Optional<Runnable> initCallback);
260:
261: /***********************************************************************************************************************************************************
262: * Binds a {@link ListView} to a {@link PresentationModel} and a callback. See {@link #bind(javafx.scene.control.ListView,
263: * it.tidalwave.ui.core.role.PresentationModel, java.util.Optional)}.
264: * @param listView the {@code ListView}
265: * @param pm the {@code PresentationModel}
266: * @param initCallback the callback
267: * @since 1.0-ALPHA-13
268: **********************************************************************************************************************************************************/
269: public default void bind (@Nonnull final ListView<PresentationModel> listView, @Nonnull final PresentationModel pm, @Nonnull final Runnable initCallback)
270: {
271: bind(listView, pm, Optional.of(initCallback));
272: }
273:
274: /***********************************************************************************************************************************************************
275: * Binds a {@link ComboBox} to a {@link PresentationModel}. See {@link #bind(javafx.scene.control.ListView, it.tidalwave.ui.core.role.PresentationModel,
276: * java.util.Optional)}.
277: * @param listView the {@code ListView}
278: * @param pm the {@code PresentationModel}
279: * @since 1.0-ALPHA-13
280: **********************************************************************************************************************************************************/
281: public default void bind (@Nonnull final ListView<PresentationModel> listView, @Nonnull final PresentationModel pm)
282: {
283: bind(listView, pm, Optional.empty());
284: }
285:
286: /***********************************************************************************************************************************************************
287: * Binds a {@link ComboBox} to a {@link PresentationModel} and an optional callback. The {@code PresentationModel} is used to populate the table. The
288: * following roles are used:
289: * <ul>
290: * <li>A {@link it.tidalwave.role.SimpleComposite} provides children {@code PresentationModel}s for each row.</li>
291: * <li>In each row, an {@link it.tidalwave.role.Aggregate<PresentationModel>} is used to provide the {@code PresentationModel}s for
292: * each column.</li>
293: * <li>A {@link it.tidalwave.ui.core.role.Displayable} (optional) is used to provide the text to render for each item.</li>
294: * <li>A {@link CustomGraphicProvider} (optional) is used to provide the graphics to render for each item.</li>
295: * <li>A {@link it.tidalwave.ui.core.role.Styleable} (optional) is used to provide the rendering style for each item.</li>
296: * <li>A {@link it.tidalwave.ui.core.role.UserActionProvider} (optional) is used to provide the actions for creating a context menu;
297: * the default action is also bound to the double click or SPACE gesture.</li>
298: * </ul>
299: * The process of populating data is performed in background threads, so this method quickly returns also in case of large amount of data. The
300: * initialization callback is called in the JavaFX thread when data population has been completed.
301: * @param comboBox the {@code ComboBox}
302: * @param pm the {@code PresentationModel}
303: * @param initCallback the callback
304: **********************************************************************************************************************************************************/
305: public void bind (@Nonnull ComboBox<PresentationModel> comboBox, @Nonnull PresentationModel pm, @Nonnull Optional<Runnable> initCallback);
306:
307: /***********************************************************************************************************************************************************
308: * Binds a {@link ComboBox} to a {@link PresentationModel} and a callback. See {@link #bind(javafx.scene.control.ComboBox,
309: * it.tidalwave.ui.core.role.PresentationModel, java.util.Optional)}.
310: * @param comboBox the {@code ComboBox}
311: * @param pm the {@code PresentationModel}
312: * @param initCallback the callback
313: * @since 1.0-ALPHA-13
314: **********************************************************************************************************************************************************/
315: public default void bind (@Nonnull final ComboBox<PresentationModel> comboBox, @Nonnull final PresentationModel pm, @Nonnull final Runnable initCallback)
316: {
317: bind(comboBox, pm, Optional.of(initCallback));
318: }
319:
320: /***********************************************************************************************************************************************************
321: * Binds a {@link ComboBox} to a {@link PresentationModel}. See {@link #bind(javafx.scene.control.ComboBox, it.tidalwave.ui.core.role.PresentationModel,
322: * java.util.Optional)}.
323: * @param comboBox the {@code ComboBox}
324: * @param pm the {@code PresentationModel}
325: * @since 1.0-ALPHA-13
326: **********************************************************************************************************************************************************/
327: public default void bind (@Nonnull final ComboBox<PresentationModel> comboBox, @Nonnull final PresentationModel pm)
328: {
329: bind(comboBox, pm, Optional.empty());
330: }
331:
332: /***********************************************************************************************************************************************************
333: * Given a {@link PresentationModel} that contains a {@link it.tidalwave.role.Composite}, populate the pane with {@link ToggleButton}s associated to the
334: * elements of the {@link it.tidalwave.role.Composite}. Each element is searched for the following roles:
335: * <ul>
336: * <li>{@link it.tidalwave.ui.core.role.UserActionProvider} (mandatory) to provide a callback for the button</li>
337: * <li>{@link it.tidalwave.ui.core.role.Displayable} to provide a text for the button</li>
338: * <li>{@link it.tidalwave.ui.core.role.Styleable} to provide a CSS style for the button</li>
339: * </ul>
340: * The pane must be pre-populated with at least one button, which will be queried for the CSS style.
341: * @param pane the {@code Pane}
342: * @param pm the {@code PresentationModel}
343: **********************************************************************************************************************************************************/
344: public void bindToggleButtons (@Nonnull Pane pane, @Nonnull PresentationModel pm);
345:
346: /***********************************************************************************************************************************************************
347: * Deprecated. Merge to bindToggleButtons, passing some arguments for choosing toggle or normal buttons.
348: * @deprecated
349: **********************************************************************************************************************************************************/
350: @Deprecated
351: public void bindButtonsInPane (@Nonnull GridPane gridPane, @Nonnull Collection<UserAction> actions);
352:
353: /***********************************************************************************************************************************************************
354: * Binds two properties of different types.
355: * @param <T> the target property type
356: * @param <S> the source property type
357: * @param target the target property
358: * @param source the source property
359: * @param adapter an adapter from one source to the target
360: * @since 2.0-ALPHA-1
361: **********************************************************************************************************************************************************/
362: public <T, S> void bind (@Nonnull final BoundProperty<? super T> target, @Nonnull final Property<? extends S> source, @Nonnull final Function<S, T> adapter);
363:
364: /***********************************************************************************************************************************************************
365: * Binds two properties of the same type.
366: * @param <T> the property type
367: * @param target the target property
368: * @param source the source property
369: * @since 2.0-ALPHA-1
370: **********************************************************************************************************************************************************/
371: public default <T> void bind (@Nonnull final BoundProperty<? super T> target, @Nonnull final Property<T> source)
372: {
373: bind(target, source, Function.identity());
374: }
375:
376: /***********************************************************************************************************************************************************
377: * Bidirectionally binds two properties of different types.
378: * @param <T> the former property type
379: * @param <S> the latter property type
380: * @param property1 the former property
381: * @param property2 the latter property
382: * @param adapter an adapter from one type to the other
383: * @param reverseAdapter the reverse adapter
384: * @since 2.0-ALPHA-1
385: **********************************************************************************************************************************************************/
386: public <T, S> void bindBidirectionally (@Nonnull final BoundProperty<? super T> property1,
387: @Nonnull final Property<S> property2,
388: @Nonnull final Function<? super S, T> adapter,
389: @Nonnull final Function<? super T, ? extends S> reverseAdapter);
390:
391: /***********************************************************************************************************************************************************
392: * {@inheritDoc}
393: **********************************************************************************************************************************************************/
394: public default <T> void bindBidirectionally (@Nonnull final BoundProperty<? super T> property1, @Nonnull final Property<T> property2)
395: {
396: bindBidirectionally(property1, property2, Function.identity(), Function.identity());
397: }
398:
399: /***********************************************************************************************************************************************************
400: * Bidirectionally binds two properties.
401: * @param property1 the former property
402: * @param property2 the latter property
403: **********************************************************************************************************************************************************/
404: public default void bindBidirectionally (@Nonnull final BoundProperty<? super Boolean> property1, @Nonnull final BooleanProperty property2)
405: {
406: bindBidirectionally(property1, property2, a -> a, a -> a);
407: }
408:
409: /***********************************************************************************************************************************************************
410: * Bidirectionally binds two properties.
411: * @param property1 the former property
412: * @param property2 the latter property
413: **********************************************************************************************************************************************************/
414: public default void bindBidirectionally (@Nonnull final BoundProperty<? super Integer> property1, @Nonnull final IntegerProperty property2)
415: {
416: bindBidirectionally(property1, property2, Number::intValue, a -> a);
417: }
418:
419: /***********************************************************************************************************************************************************
420: * Bidirectionally binds two properties.
421: * @param property1 the former property
422: * @param property2 the latter property
423: **********************************************************************************************************************************************************/
424: public default void bindBidirectionally (@Nonnull final BoundProperty<? super Long> property1, @Nonnull final LongProperty property2)
425: {
426: bindBidirectionally(property1, property2, Number::longValue, a -> a);
427: }
428:
429: /***********************************************************************************************************************************************************
430: * Bidirectionally binds two properties.
431: * @param property1 the former property
432: * @param property2 the latter property
433: **********************************************************************************************************************************************************/
434: public default void bindBidirectionally (@Nonnull final BoundProperty<? super Double> property1, @Nonnull final DoubleProperty property2)
435: {
436: bindBidirectionally(property1, property2, Number::doubleValue, a -> a);
437: }
438:
439: /***********************************************************************************************************************************************************
440: *
441: **********************************************************************************************************************************************************/
442: public void bindBidirectionally (@Nonnull TextField textField, @Nonnull BoundProperty<String> textProperty, @Nonnull BoundProperty<Boolean> validProperty);
443:
444: /***********************************************************************************************************************************************************
445: * Shows a modal dialog with the given content and provides feedback by means of the given notification.
446: * @param notification the object notifying whether the operation is confirmed or cancelled
447: * @since 1.1-ALPHA-6
448: **********************************************************************************************************************************************************/
449: public default void showInModalDialog (@Nonnull final UserNotification notification)
450: {
451: showInModalDialog(UserNotificationWithFeedback.notificationWithFeedback()
452: .withCaption(notification.getCaption())
453: .withText(notification.getText()));
454: }
455:
456: /***********************************************************************************************************************************************************
457: * Shows a modal dialog with the given content and provides feedback by means of the given notification.
458: * @param node the dialog content
459: * @param notification the object notifying whether the operation is confirmed or cancelled
460: **********************************************************************************************************************************************************/
461: public void showInModalDialog (@Nonnull UserNotificationWithFeedback notification, @Nonnull Optional<Node> node);
462:
463: // FIXME: use a Builder, merge with the above
464: public default void showInModalDialog (@Nonnull final Node node,
465: @Nonnull final UserNotificationWithFeedback notification,
466: @Nonnull final BoundProperty<Boolean> valid)
467: {
468: showInModalDialog(notification, Optional.of(node));
469: }
470:
471: @Deprecated
472: public default void showInModalDialog (@Nonnull final Node node, @Nonnull final UserNotificationWithFeedback notification)
473: {
474: showInModalDialog(notification, Optional.of(node));
475: }
476:
477: public default void showInModalDialog (@Nonnull final UserNotificationWithFeedback notification)
478: {
479: showInModalDialog(notification, Optional.empty());
480: }
481:
482: /***********************************************************************************************************************************************************
483: * Opens the FileChooser for selecting a file. The outcome of the operation (confirmed or cancelled) will be notified to the given notification object. The
484: * selected file will be set to the given bound property, which can be also used to set the default value rendered on the FileChooser.
485: * @param notification the object notifying whether the operation is confirmed or cancelled
486: * @param selectedFile the property containing the selected file
487: **********************************************************************************************************************************************************/
488: public void openFileChooserFor (@Nonnull UserNotificationWithFeedback notification, @Nonnull BoundProperty<Path> selectedFile);
489:
490: /***********************************************************************************************************************************************************
491: * Opens the FileChooser for selecting a folder. The outcome of the operation (confirmed or cancelled) will be notified to the given notification object.
492: * The selected folder will be set to the given bound property, which can be also used to set the default value rendered on the FileChooser.
493: * @param notification the object notifying whether the operation is confirmed or cancelled
494: * @param selectedFolder the property containing the selected folder
495: **********************************************************************************************************************************************************/
496: public void openDirectoryChooserFor (@Nonnull UserNotificationWithFeedback notification, @Nonnull BoundProperty<Path> selectedFolder);
497: }